package com.educate.controller;

import com.educate.common.api.Result;
import com.educate.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author yjj
 * @date 2021/11/22
 * @description: onlineCourse
 */
@Api(tags = "在线课程接口")
@RestController
@RequestMapping("/course")
public class OnlineCourseController {

    @Autowired
    private CourseService courseService;

    /**
     *获取所有的在线课程
     */
    @ApiOperation("获取所有的在线课程")
    @GetMapping("/online")
    public Result getAllOnlineCourse(){
        return Result.success(courseService.getOnlineCourse());
    }

    @ApiOperation("删除课程信息")
    @GetMapping("/deleteCourse")
    public Result deleteCourse(@ApiParam(value = "课程id",required = true) @RequestParam("courseId") Long courseId){
        courseService.deleteCourse(courseId);
        return Result.success("删除成功！");
    }
}
